#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
typedef pair<int,int> pii;
    vector<int> minimumTime(int n, vector<vector<int>>& edges, vector<int>& disappear) {
        vector<vector<pii>> g(n);
        for(auto& it:edges)
        {
            int a=it[0],b=it[1],c=it[2];
            g[a].emplace_back(b,c);
            g[b].emplace_back(a,c);
        }
        priority_queue<pii,vector<pii>,greater<pii>> q;
        vector<int> d(disappear.begin(),disappear.end());
        d[0]=0;
        q.emplace(0,0);
        while(!q.empty())
        {
            auto [dist_x,x]=q.top();
            q.pop();
            if(dist_x>d[x]) continue;
            for(auto& [y,dist_y]:g[x])
            {
                int new_d=dist_x+dist_y;
                if(new_d<d[y])
                {
                    d[y]=new_d;
                    q.emplace(new_d,y);
                }

            }
        }
        for(int i=0;i<n;i++)
            if(d[i]==disappear[i]) d[i]=-1;
        return d; 
        
    }
};

int main()
{
    vector<vector<int>> vec={{0,1,2},{0,2,4},{1,2,1}};
    Solution so;
    vector<int> vec1={1,1,5};
    so.minimumTime(3,vec,vec1);

}